//
//  BaseTabBarController.m
//  NewsAndFuns
//
//  Created by lanou3g on 15/7/13.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "BaseTabBarController.h"
#import "BaseNavigationController.h"
@interface BaseTabBarController ()

@end

@implementation BaseTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NewsViewController *news = [[NewsViewController alloc]init];
    [self addChildViewController:news image:@"News" title:@"新闻汇"];
    
    FunsViewController *funs = [[FunsViewController alloc]init];
    [self addChildViewController:funs image:@"Movie" title:@"娱乐汇"];
    
    SettingsTableViewController *set = [[SettingsTableViewController alloc]initWithStyle:UITableViewStylePlain];
    [self addChildViewController:set image:@"Settings" title:@"设置"];
    
    self.tabBar.tintColor = [UIColor redColor];
    self.tabBar.backgroundImage = [UIImage imageNamed:@"TabBarBackground"];
    self.tabBar.alpha = 0.9;
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)addChildViewController:(UIViewController *)childController image:(NSString *)image title:(NSString *)title
{
    childController.tabBarItem.image = [UIImage imageNamed:image];
    childController.tabBarItem.title = title;
    
    BaseNavigationController *nav = [[BaseNavigationController alloc]initWithRootViewController:childController];
    [self addChildViewController:nav];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
